/**
 * Created by Francis.LW on 2017/10/20.
 *
 * 表单项服务接口
 */
import {postRequest, getRequest} from '@/common/request'
import {urls} from './url'

const formItemApi = urls.formItem


function listFormItem(param, page, pageSize, success, complete) {
  postRequest(formItemApi.listFormItem + '?currentpage=' + page + '&pagesize=' + pageSize, {}, param, success, complete)
}

function addFormItem(param, success, complete) {
  postRequest(formItemApi.addFormItem, {}, param, success, complete)
}

function updateFormItem(id, param, success, complete) {
  postRequest(formItemApi.updateFormItem + id, {}, param, success, complete)
}

function getFormItem(id, success, complete) {
  getRequest(formItemApi.getFormItem + id, {}, success, complete)
}

function removeFormItem(ids, success, complete) {
  postRequest(formItemApi.removeFormItem, {}, ids, success, complete)
}

function deleteSingleFormItem(id, success, complete) {
  let ids = []
  ids.push(id)
  removeFormItem(ids, success, complete)
}

export default {
  listFormItem,
  addFormItem,
  updateFormItem,
  getFormItem,
  removeFormItem,
  deleteSingleFormItem
}
